All Questions
15 questions
0votes
1answer
483views
Class that counts its instances
I'd love some feedback on the C++ base class shown below. It's basically a toy problem for a fake video game where the monsters that you have to avoid will all be sub-classed from the class shown ...
4votes
1answer
3kviews
OpenGL Mesh Class
I've written a simple mesh class. The purpose of it is to build a mesh, draw it to the screen, and provide some means by which the mesh can be transformed/scaled, etc. This was done with GLAD, GLFW, ...
-1votes
1answer
354views
abstract base classes versus the curiously recurring template pattern [closed]
Background Apologies for "burying the lead." The questions are in the next section. In my application, the purpose of inheritance is to abstract away complicated logic in the base class template, so ...
1vote
1answer
170views
Shift register library design
I am creating a small library for controlling bars of leds and have some doubts about my design. I have 2 basic entities in the design so far: BarService (and implementation) ...
0votes
1answer
1kviews
C++ linked list inheriting from node class
I am currently in between semesters at school and am using that time to improve on my knowledge of C++ classes by making a node class and a linked list class that inherits from the node class. There ...
5votes
1answer
350views
"Detailed" exception class hierarchy
I'm designing an modular exception class hierarchy to use in various projects. I intend to inherit from std::exception in order to be maximally compatible with any ...
3votes
2answers
394views
Implementing different types of light sources in a Graphics project
Edit: I got asked a lot why I need to have the LightSource base class or why do I keep one vector of all the light sources, so here's my explanation: In many ...
2votes
1answer
186views
Managing different types of morphism and their compositions
Here's some code I wrote to manage the different types of morphism and their compositions in C++17. Let me know if you had any suggestions for substantial simplifications or improvements, or if I ...
5votes
1answer
71views
Class Item: A new Implementation to the qes already asked
This is a follow-up question to this: class-item-answer-to-one-of-the-unsolved-stack-overflow-qes. As per the comments I received from @Ben Steffan, I have re-written the above classes as follows. ...
3votes
2answers
927views
Serializing a class hierarchy to JSON
I have a hierarchical object structure which needs to be converted to JSON. I have a following basic implementation of how it will be done: ...
2votes
1answer
6kviews
Pizza Delivery System
I have made this code as my summers vacation project in Turbo C++ (I know its old and outdated, but that's what they teach us in our school). The code allows users to order different pizzas and even ...
4votes
2answers
2kviews
Sorting polymorphic classes
I'm learning from "Jumping into C++" by Alex Allain (sample chapter and TOC) and solved the first problem in Chapter 26 "Inheritance and Polymorphism". I'm especially concerned about my use of ...
5votes
1answer
366views
The rounded box that wanted to be an arc
This is from Bjarne Stroustrup's C++ Programming: Principles and Practice, Chapter 13 Exercise 2: Draw a box with rounded corners. Define a class Box, consisting ...
2votes
3answers
763views
Music collection with lyric songs and instrumental pieces
I have problems with dealing with derived classes that inherit from the same base class. I have 2 types of songs: Songs with lyrics that have: Title, Tags (sad, happy etc.), lyrics (one line), writer....
1vote
1answer
272views
Driver-layer from top-level app to hardware
I'm attempting to implement driver-layer (shared library) from top-level app to hardware. In the first, I extracted interface functions, which further will be called from "extern "C" SHARED" wrappers ...